home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 001-025 / disk_015 / fish / start.c < prev   
C/C++ Source or Header  |  1992-05-06  |  2KB  |  114 lines

  1. #include <exec/types.h>
  2. #include <exec/nodes.h>
  3. #include <exec/lists.h>
  4. #include <graphics/gfx.h>
  5. #include <graphics/clip.h>
  6. #include <graphics/rastport.h>
  7. #include <graphics/view.h>
  8. #include <graphics/text.h>
  9. #include <graphics/gfxmacros.h>
  10.  
  11. #include <graphics/layers.h>
  12. #include <intuition/intuition.h>
  13.  
  14. #define DEPTH 3 
  15.  
  16. #define TXHEIGHT 8
  17.  
  18. struct TextAttr TestFont =
  19.     {
  20.     "topez.font",
  21.     TXHEIGHT,
  22.     0,
  23.     0,
  24.     };
  25.  
  26. long GfxBase = 0;
  27. long LayersBase = 0;
  28. long IntuitionBase = 0;
  29.  
  30. startgfx(x,y,height, width, n_bit_Planess, palette, gfxproc,s,flags,sbitmap)
  31. WORD x,y;
  32. WORD height, width, n_bit_Planess;
  33. UWORD *palette;
  34. int (*gfxproc)();
  35. UBYTE *s;
  36. struct BitMap *sbitmap;        /* optional parameter */
  37. {
  38.     struct Screen *myscreen;
  39.     struct Window *window;
  40.     struct RastPort *w=0;
  41.     struct View *view;
  42.     register i, j;
  43.     int idcmp;
  44.     struct NewWindow nw;
  45.     struct NewScreen ns;
  46.  
  47.     
  48.     GfxBase = OpenLibrary("graphics.library",31);
  49.     if (GfxBase == 0)
  50.     {
  51.         exit();
  52.     }
  53.  
  54.     LayersBase = OpenLibrary("layers.library",31);
  55.     if (LayersBase == 0)
  56.     {
  57.         exit();
  58.     }
  59.  
  60.  
  61.     IntuitionBase = OpenLibrary("intuition.library",31);
  62.     if (IntuitionBase == 0)
  63.     {
  64.         exit();
  65.     }
  66.  
  67.     /* intuition direct comunication message port */
  68.     idcmp = CLOSEWINDOW|REFRESHWINDOW;
  69.  
  70.     ns.LeftEdge = 0;
  71.     ns.TopEdge = 0;
  72.     ns.Width = 320;
  73.     ns.Height = 200;
  74.     ns.Depth = DEPTH;
  75.     ns.DetailPen = -1;
  76.     ns.BlockPen = -1;
  77.     ns.ViewModes = 0;
  78.     ns.Type = CUSTOMSCREEN;
  79.     ns.Font = &TestFont;
  80.     ns.DefaultTitle = NULL;
  81.     ns.Gadgets = NULL;
  82.  
  83.     if ((myscreen =(struct Screen *)OpenScreen(&ns)) == 0)
  84.            {
  85.             exit(1);
  86.         }
  87.  
  88.  
  89.     nw.LeftEdge = x;
  90.     nw.TopEdge = y;
  91.     nw.Width = width;
  92.     nw.Height = height;
  93.     nw.DetailPen = -1;
  94.     nw.BlockPen = -1;
  95.     nw.IDCMPFlags = idcmp;
  96.     nw.Flags = WINDOWDEPTH|WINDOWSIZING|WINDOWDRAG|WINDOWCLOSE|flags;
  97.     nw.FirstGadget = 0;
  98.     nw.CheckMark = 0;
  99.     nw.Title = s;
  100.     nw.Screen = 0;
  101.     nw.BitMap = sbitmap;
  102.     nw.MinWidth = 80;
  103.     nw.MinHeight = 16;
  104.     nw.MaxWidth = 640;
  105.     nw.MaxHeight = 200;
  106.     nw.Type = WBENCHSCREEN;
  107.  
  108.     window = (struct Window *)OpenWindow(&nw);
  109.     view = (struct View *)ViewAddress(); 
  110.     (*gfxproc)(myscreen,view,&myscreen->ViewPort,&myscreen->RastPort,window);
  111.     CloseWindow(window);    
  112.     CloseScreen(myscreen);
  113. }
  114.